#ifndef __SERIALCOM_H_
#define __SERIALCOM_H_

#include "usart.h"
#include "userheader.h"

#define PRO_BUF_LEN 1024
#define RECTANGLE         1    //接收到的数据为矩形框模式
#define REDCOORDINATE     2    //接收到的数据为红色坐标模式
#define GREENCOORDINATE   3    //接收到的数据为绿色坐标模式
#define REDANDGREENCOORDINATE     4 //接收到的数据为红色与绿色坐标模式
#define RASPIMOOD     5         //接收到的数据为树莓派当前状态

#define RASRED     			1   //树莓派红色激光识别模式
#define RASGREEN     		2   //树莓派识别绿色坐标模式
#define RASRECTANGLE     	3 	//树莓派识别矩形框模式
#define SETFOVPARAM      	4	//树莓派识别矩形框模式
#define SETREDPARAM      	5 	//树莓派识别矩形框模式
#define SETRECTPARAM     	6  	//树莓派识别矩形框模式

extern RectangleCoordinateDef g_rectangle_coordinate;
extern SingleCoordinateDef g_red_coordinate,g_green_coordinate;
extern SingleCoordinateDef g_origin_coordinate,g_topright_coordinate,g_topleft_coordinate,g_bottomright_coordinate,g_bottomleft_coordinate;
extern unsigned char g_raspi_mood,set;
extern PointDef g_rectangle[512];

extern RxProBufDef RxProBuf;

void serialInit(void);


uint16_t Numerical_analysis(uint8_t *NumStartIndex,char endchar,uint8_t **header);
void rectangleCoordinateGet(uint8_t *rxProBuf,RectangleCoordinateDef rectangleCoordinate );
uint8_t judgmenMood(RxProBufDef buf );
SingleCoordinateDef singleLightCoordinateGet(uint8_t *rxProBuf);
void sendInt(int data);

void positionCorrection(uint8_t data);
uint8_t getRaspiMood(uint8_t *rxProBuf);
void changeRaspiMood(uint8_t raspiMood);

#endif
